function fnlogining1() {
    var username = document.getElementById("ID").value;
    var password = document.getElementById("PASSWORD").value;
    if (username == "") {
        alert("用户名不能为空！", {header: '提醒'});
    } else if (password == "") {
        alert("密码不能为空！", {header: '提醒'});
    } else {
        AjaxFunc();
    }
}
function AjaxFunc(){
    var username = document.getElementById("ID").value;
    var password = document.getElementById("PASSWORD").value;
    let matchResult = true;
    if (username == "" || password == "") {
        alert("请确认用户名密码是否为空！");
        matchResult = false;
    } else if (username.length < 6 || username.length > 20) {
        alert("用户名长度应在6到20个字符之间！");
        matchResult = false;
    } else if (password.length < 6 || password.length > 20) {
        alert("密码长度应在6到20个字符之间！");
        matchResult = false;
    }
    if (matchResult == true){
        ServerAgent.invoke("login", {username, password}).then(res => {
            console.log(res);
            if(res.allowLogin){
                location.href = "/home";
                return;
            }
            alert("用户名密码输入错误");
        })
    }
}